#ifndef TANKMODEL_H
#define TANKMODEL_H

#include "projectile.h"
#include <cmath>

class TankModel
{
public:
    static const double width_ = 10.0;
    static const double height_ = 10.0;
    static const double barrelLength_ = 15.0;
    static const double angleChangeStep_;
    static const double angleChangeStepShifted_;

    TankModel();

    virtual void render();
    void explode();

    void increaseAngle(bool shifted);
    void decreaseAngle(bool shifted);

    mutable double pos_;

protected:
    mutable double angle_;

    inline double barrelX() const
    {
        return barrelLength_ * cos(3.14 * angle_ / 180.0);
    }

    inline double barrelY() const
    {
        return barrelLength_ * sin(3.14 * angle_ / 180.0);
    }
};


class Player : public TankModel
{
public:
    Projectile* fire(double maxRange);
};


class Opponent : public TankModel
{

};

#endif // TANKMODEL_H
